package cn.hchaojie.blog.web.demo;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;

public class FormServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// title, category, content
		
		System.out.println(req.getParameter("title"));
		System.out.println(req.getParameter("category"));
		System.out.println(req.getParameter("content"));
		
		Map<String, String> map = new HashMap<>();
		map.put("code", "0");
		map.put("message", "success");
		
		String string = JSON.toJSONString(map);
		
		resp.setContentType("application/json;charset=utf-8");
		resp.getWriter().write(string);
	}
}
